#@adminLayout()

#define main()
### isAdd 表示创建，isEdit 表示修改
#set(isAdd = wordcolor == null ? true : false, isEdit = !isAdd)

<div class="jfa-header-box" id="jfa-header-box">
	<div class="jfa-crumbs" id="jfa-crumbs">
		色彩义管理 / #(isAdd ? "创建" : "修改")
	</div>
	<div class="jfa-search-box"></div>
	#include("/_view/_admin/common/_header_right.html")
</div>

### 内容区域
<div class="jfa-content-box" id="jfa-content-box">
	<div class="jfa-content" id="jfa-content">
		<form class="clearfix margin-top-25" id="myArticleForm" action="/admin/wordcolor/#(isAdd ? 'save' : 'update')" method="post">

			#if (isEdit)
			<input type="hidden" name="wordcolor.id" value="#(wordcolor.id)" />
			#end
			<div class="form-group margin-bottom-20">
				<label>词语名称</label>
				<input type="text"  class="form-control" name="wordcolor.wordName" value="#(wordcolor.wordName??)" placeholder="#(wordcolor.wordName??)" />
			</div>

			<div class="form-group margin-bottom-20">
				<label>色彩义</label>
				<div>
					<input type="text"  class="form-control" name="wordcolor.content" value="#(wordcolor.content??)" placeholder="#(wordcolor.content??)" />
				</div>
			</div>

			<div class="pull-right margin-bottom-20" >
				<input class="btn btn-primary" type="submit" value="提交" />
			</div>
		</form>

	</div><!-- END OF jfa-content -->
</div><!-- END OF jfa-content-box -->

<style type="text/css">
	.jfa-content label {
		line-height: 1;
		vertical-align: baseline;
		color: #23527c;
		font-size: 20px;
		font-weight: normal;
		margin-bottom: 8px;;
	}
</style>

<script type="text/javascript">
	$(document).ready(function() {
		$("#myArticleForm").ajaxForm({
			dataType: "json"
			, beforeSubmit: function(formData, jqForm, options) {}
			, success: function(ret) {
				if (ret.state == "ok") {
					location.href = "/admin/wordcolor?p=#(p ?? 1)";
				} else {
					showFailMsg(ret.msg);
				}
			}
			, error: function(ret) {alert(ret.statusText);}
			, complete: function(ret) {} 	      // 无论是 success 还是 error，最终都会被回调
		});
	});
</script>

#end
